package com.piedra.thinkinginjava.thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;


public class ExecutorTest {

	public static void main(String[] args) {
		ExecutorService exec = Executors.newFixedThreadPool(2);
		for(int i=0; i<3; i++){
			exec.execute(new MyTask());
		}
		exec.shutdown();
		System.out.println("main method() ...");
	}
}

class MyTask implements Runnable{
	public void run(){
		for(int i=0; i<3; i++){
			System.out.println(Thread.currentThread().getName() + "  is running ... " + i);
		}
	}
}
